#include "Guard.h"
#include "../data/GameInfo.h"

Guard::Guard()
{
    skillList = {SkillId::SKILL_RASENGAN};
    GameAnimation::InitFrameData(GameInfo::Instance().texturePool[TexId::TEX_GUARD_ATTACK],
                                 animAttack, 4, 4, false);
    GameAnimation::InitFrameData(GameInfo::Instance().texturePool[TexId::TEX_GUARD_DIE],
                                 animDie, 4, 9, false, [this] { OnDie(); }, 0.05);
    GameAnimation::InitFrameData(GameInfo::Instance().texturePool[TexId::TEX_GUARD_STANDBY],
                                 animStandBy, 4, 4);
    GameAnimation::InitFrameData(GameInfo::Instance().texturePool[TexId::TEX_GUARD_WALK],
                                 animWalk, 4, 4);

    for (int i = 0; i < Facing::SIZE; i++) {
        animRigidity[i].Copy(animDie[i]);
        animRigidity[i].rectSrcList = {animDie[i].rectSrcList[0]};
        animRigidity[i].timer.waitTime = 1;
        animRigidity[i].onFinished = [this] { OnRigidity(); };
        animRelease[i].Copy(animAttack[i]);
        animRelease[i].rectSrcList = {animAttack[i].rectSrcList[0], animAttack[i].rectSrcList[1],};
        animChant[i].Copy(animAttack[i]);
        animChant[i].rectSrcList = {animAttack[i].rectSrcList[0], animAttack[i].rectSrcList[1],};
    }

    attackMix = GameInfo::Instance().mixPool[MixId::MIX_SWORD_ATTACK];
}